<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li ><a href="{:url('skill/index')}">列表</a></li>
			<li class="active"><a >{:lang('EDIT')}</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('skill/editPost')}">
            <div class="form-group">
				<label for="input-classid" class="col-sm-2 control-label"><span class="form-required">*</span>分类</label>
				<div class="col-md-6 col-sm-10">
                    <select class="form-control" name="classid" style="width: 100px;">
                        <volist name="class" id="v">
                            <option value="{$v['id']}" <if condition="$data['classid'] eq $v['id']">selected</if>>{$v['name']}</option>
                        </volist>
                    </select>
				</div>
			</div>
            <div class="form-group">
				<label for="input-name" class="col-sm-2 control-label"><span class="form-required">*</span>名称</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-name" name="name" value="{$data.name}">
				</div>
			</div>
            
            <div class="form-group" style="display:none;">
				<label for="input-name_en" class="col-sm-2 control-label"><span class="form-required">*</span>名称-英文</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-name_en" name="name_en" value="{$data.name_en}">
				</div>
			</div>
            
            <div class="form-group">
				<label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>封面</label>
				<div class="col-md-6 col-sm-10">
					<input type="hidden" name="thumb" id="thumbnail" value="{$data['thumb']}">
                    <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                        <if condition="empty($data.thumb)">
                        <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                 id="thumbnail-preview"
                                 style="cursor: pointer;max-width:100px;max-height:100px;"/>
                        <else/>
                        <img src="{:get_upload_path($data.thumb)}"
                             id="thumbnail-preview"
                             style="cursor: pointer;max-width:100px;max-height:100px;"/>
                        </if>
                    </a>
                    <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片"> 建议尺寸： 100 X 100
				</div>
			</div>
            
            <div class="form-group">
				<label for="input-method" class="col-sm-2 control-label"><span class="form-required">*</span>收费方式</label>
				<div class="col-md-6 col-sm-10">
					<select class="form-control" id="method" name="method" style="width: 100px;">
                        <volist name="method" id="v">
                            <option value="{$v}" <if condition="$data['method'] eq $v">selected</if>>{$v}</option>
                        </volist>
                    </select>
				</div>
			</div>
			<div class="form-group"  id="methodminutes_bd" <if condition="$data['method'] eq '半小时' OR $data['method'] eq '小时' "> style="display:none;"</if> >
					<label for="input-methodminutes" class="col-sm-2 control-label"><span class="form-required">*</span>陪玩时长</label>
					<div class="col-md-6 col-sm-10">
						<select class="form-control" name="methodminutes" style="width: 100px;">
							<volist name="methodminutes" id="v">
								<option value="{$v}" <if condition="$data['methodminutes'] eq $v">selected</if>>{$v}分钟</option>
							</volist>
						</select>
					</div>
				</div>
            
         <!--     <div class="form-group">
				<label for="input-colour_font" class="col-sm-2 control-label"><span class="form-required">*</span>颜色-字体</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control js-color" name="colour_font" style="display:inline-block;width:200px;" value="{$data['colour_font']}"> 
                    <input  class="form-control colour_block" style="display:inline-block;width:50px;background:{$data['colour_font']};" disabled/>
				</div>
			</div>
            <div class="form-group">
				<label for="input-colour_bg" class="col-sm-2 control-label"><span class="form-required">*</span>颜色-背景</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control js-color" name="colour_bg" style="display:inline-block;width:200px;" value="{$data['colour_bg']}"> 
                    <input  class="form-control colour_block" style="display:inline-block;width:50px;background:{$data['colour_bg']};" disabled/>
				</div>
			</div>-->
            
            <div class="form-group">
				<label for="input-auth_tip" class="col-sm-2 control-label"><span class="form-required">*</span>认证提示</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-auth_tip" name="auth_tip" value="{$data.auth_tip}">
				</div>
			</div>
            
            <div class="form-group" style="display:none;">
				<label for="input-auth_tip_en" class="col-sm-2 control-label"><span class="form-required">*</span>认证提示-英文</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-auth_tip_en" name="auth_tip_en" value="{$data.auth_tip_en}">
				</div>
			</div>


            <div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<input type="hidden" name="id" value="{$data.id}" />
					<input type="hidden" name="thumb_old" value="{$data['thumb']}">												
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('EDIT')}</button>
					<a class="btn btn-default" href="{:url('skill/index')}">{:lang('BACK')}</a>
				</div>
			</div>

		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
    <script>
        (function(){
            Wind.use('colorpicker',function(){
                $('.js-color').each(function () {
                    var $this=$(this);
                    $this.ColorPicker({
                        livePreview:true,
                        onChange: function(hsb, hex, rgb) {
                            $this.val('#'+hex);
                            $this.siblings(".colour_block").css('background','#'+hex);
                        },
                        onBeforeShow: function () {
                            $(this).ColorPickerSetColor(this.value);
                        }
                    });
                });

            });
            $('.btn-cancel-thumbnail').click(function () {
                $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
                $('#thumbnail').val('');
            });
			$("#method").on('change',function(){
                var v=$("#method option:selected").val();
				if(v!="小时" && v!="半小时"){
					$("#methodminutes_bd").show();
				}else{
					$("#methodminutes_bd").hide();
				}
                
               
            });
        })()
    </script>
    <script>
        
      </script>
</body>
</html>